﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>骏怡连锁酒店后台管理-客房管理</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="assets/materialize/css/materialize.min.css" media="screen,projection" />
    <!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
    <!-- Morris Chart Styles-->
    <link href="assets/js/morris/morris-0.4.3.min.css" rel="stylesheet" />
    <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <link rel="stylesheet" href="assets/js/Lightweight-Chart/cssCharts.css">
<style>
     td{ text-align: center; }
     button a{text-decoration: none;}
     #btnzmx{
         margin-left: 5px;
         margin-bottom: 20px;
        float: right;
     }
     .wrapper{
         /* 10行5列 */
         display: grid;
         /* 五列：每列宽度100px */
         /* grid-template-columns: 100px 100px 100px 100px 100px; */
         /* 等分单位宽度 */
         /* grid-template-columns: 1fr 1fr 1fr 1fr 1fr; */
         /* 通过容器的宽度来改变列的数量,尽可能多地将 100px 宽的列排列在容器中*/
         /* grid-template-columns: repeat(auto-fit,100px); */
         /* 列的宽度至少 100px 。如果有更多的可用空间，网格将简单地分配给每个列,因为列的值变成了一个等分单位 1fr */
         grid-template-columns: repeat(auto-fit,minmax(100px,1fr));
         /* 10行：每行高度100px*/
         /* grid-template-rows: 100px 100px 100px 100px 100px 100px 100px 100px 100px 100px; */
         grid-template-rows: repeat(5,100px);
         /* Gird 间距 */
         grid-gap: 5px;
     }
     .wrapper .item{
         background: yellowgreen;
         text-align: center;
         line-height: 100px;
         color: white;
         font-size: 20px;
     }
</style>
</head>

<body>
    <div id="wrapper">
        <nav class="navbar navbar-default top-navbar" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle waves-effect waves-dark" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand waves-effect waves-dark" href="index.html">
                    <i class="large material-icons">track_changes</i>
                    <strong>Hotel Manage</strong>
                </a>

                <div id="sideNav" href="">
                    <i class="material-icons dp48">toc</i>
                </div>
            </div>

            <ul class="nav navbar-top-links navbar-right">
                <li>
                    <a class="dropdown-button waves-effect waves-dark" href="#!" data-activates="dropdown1">
                        <i class="fa fa-user fa-fw"></i>
                        <b id='admin'></b>
                        <i class="material-icons right">arrow_drop_down</i>
                    </a>
                </li>
            </ul>
        </nav>
        <!-- Dropdown Structure -->
        <ul id="dropdown1" class="dropdown-content">
            <li>
                <a href="#">
                    <i class="fa fa-user fa-fw"></i> 个人中心</a>
            </li>
            <li>
                <a href="#">
                    <i class="fa fa-gear fa-fw"></i> 设置</a>
            </li>
            <li id='logoutBtn'>
                <a href="#">
                    <i class="fa fa-sign-out fa-fw"></i> 退出登录</a>
            </li>
        </ul>
        <!--/. NAV TOP  -->
        <!--/. NAV TOP  -->
        <nav class="navbar-default navbar-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
                    <li>
                        <a class="waves-effect waves-dark" href="index.html">
                            <i class="fa fa-dashboard"></i> 首页</a>
                    </li>
                    <li>
                        <a href="employee.html" class="waves-effect waves-dark">
                            <i class="fa fa-desktop"></i> 员工管理</a>
                    </li>
                    <li>
                        <a href="room.html" class="active-menu waves-effect waves-dark">
                            <i class="fa fa-bar-chart-o"></i> 客房管理</a>
                    </li>
                    <li>
                        <a href="role.html" class="waves-effect waves-dark">
                            <i class="fa fa-qrcode"></i>角色管理</a>
                    </li>

                    <li>
                        <a href="user.html" class="waves-effect waves-dark">
                            <i class="fa fa-table"></i>用户管理</a>
                    </li>
                </ul>

            </div>

        </nav>
        <!-- /. NAV SIDE  -->
        <div id="page-wrapper">
            <div class="header">
                <h1 class="page-header">
                    客房管理
                </h1>
                <ol class="breadcrumb">
                    <li>
                        <a href="#">主页</a>
                    </li>
                    <li>
                        <a href="#">客房管理</a>
                    </li>
                    <li class="active">数据</li>
                </ol>

            </div>
            <div id="btnzmx">
                <a href="Typeofroom.html" class="btn btn-info">客房类型</a>
                <a href="Typeofroom.html" class="btn btn-warning">添加客房</a>
           </div>
           <div class="page-header">
            <a href="javascript:;" class="btn btn-default active">一层</a>
            <a href="javascript:;" class="btn btn-default">二层</a>
            <a href="javascript:;" class="btn btn-default">三层</a>
            <a href="javascript:;" class="btn btn-default">四层</a>
           </div>
            <div id="page-inner">
                       <div class="wrapper">
                            <div class="item">1</div>
                            <div class="item">2</div>
                            <div class="item">3</div>
                            <div class="item">4</div>
                            <div class="item">5</div>
                            <div class="item">6</div>
                            <div class="item">7</div>
                            <div class="item">8</div>
                            <div class="item">9</div>
                            <div class="item">10</div>
                            <div class="item">11</div>
                            <div class="item">12</div>
                            <div class="item">13</div>
                            <div class="item">14</div>
                            <div class="item">15</div>
                            <div class="item">16</div>
                            <div class="item">17</div>
                            <div class="item">18</div>
                            <div class="item">19</div>
                            <div class="item">20</div>
                            <div class="item">21</div>
                            <div class="item">22</div>
                            <div class="item">23</div>
                            <div class="item">24</div>
                            <div class="item">25</div>
                            <div class="item">26</div>
                            <div class="item">27</div>
                            <div class="item">28</div>
                            <div class="item">29</div>
                            <div class="item">30</div>
                       </div>
                
                <!-- /. ROW  -->
              
            </div>
            <!-- /. PAGE INNER  -->
        </div>
        <!-- /. PAGE WRAPPER  -->
    </div>
    <!-- /. WRAPPER  -->
    <!-- JS Scripts-->
    <!-- jQuery Js -->
    <script src="assets/js/jquery-1.10.2.js"></script>

    <!-- Bootstrap Js -->
    <script src="assets/js/bootstrap.min.js"></script>

    <script src="assets/materialize/js/materialize.min.js"></script>

    <!-- Metis Menu Js -->
    <script src="assets/js/jquery.metisMenu.js"></script>
    <!-- Morris Chart Js -->
    <script src="assets/js/morris/raphael-2.1.0.min.js"></script>
    <script src="assets/js/morris/morris.js"></script>


    <script src="assets/js/easypiechart.js"></script>
    <script src="assets/js/easypiechart-data.js"></script>

    <script src="assets/js/Lightweight-Chart/jquery.chart.js"></script>

    <!-- Custom Js -->
    <script src="assets/js/custom-scripts.js"></script>
    <script src="assets/js/public.js"></script>

        <script>
        $.ajax({
            url: 'rooms',
            method: "GET",
            success: function(data) {
                var table=$('table');
               $.each(data,function(index,value){
                    let c = `<table class='table'><tr><th>姓名</th><th>电话</th><th>身份证号码</th></tr>`;
                    for(i=0;i<value.custom.length;i++){
                        c += `<tr><td>${value.custom[i].name}</td><td>${value.custom[i].idCard}</td><td>${value.custom[i].phone}</td></tr>`;
                    };
                    c += `</table>`;
                    let photos=''; 
                    for(i=0;i<value.photos.length;i++){
                        p=value.photos[i]
                        photos +=`<img src='assets/img/${p}' style='width:100px;height:80px;'>&nbsp;`
                    }  
                    let tr =$(`<tr>
                            <td>${value.number}</td>
                            <td>${value.state}</td>
                            <td>${value.type.name}</td>
                            <td>¥${value.type.price}</td>
                            <td style="text-align:left;">${photos}</td>
                            <td align='left'>${c}</td>
                            <td style="vertical-align:middle;">
                                <button class="btn btn-success btn-block" rel="${value.id}">${value.custom.length<1?'入住':'退房'}</button>
                                <button class="btn btn-primary btn-block modify" rel="${value.id}">修改</button>
                                <button class="btn btn-danger  btn-block removeBtn" id="${value.id}">删除</button></td>
                        </tr>`).addClass(value.state == "有人" ? 'yellow' : '');
                    table.append(tr);
                })
            }
        })

    </script>
</body>

</html>